{extend name='index/base' /}

{block name='main'}
<body>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray "> <span class="l"><a href="javascript:;" onclick="modaldemo()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加</a></span>  </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th>ID</th>
                <th>主账号</th>
                <th>经纪商</th>
                <th>监控员</th>
                <th>说明</th>
                <th>状态</th>
            </tr>
            </thead>
            <tbody>
            {volist name='list' id='user'}
            <tr class="text-c">

                <td>{$user.id}</td>
                <td>{$user.account}</td>
                <td>{$user.BrokderID}</td>
                <td>{$user.MonitorID}</td>
                <td>{$user.commit}</td>
                <td>
                    <a href="{:url('admin/System/dochangeaccount')}?id={$user.id}&aid={$user.aid}">{if condition="$user.status == 1"} <span style="color: red">当前主账号</span> {else /}设为主账号{/if}</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </div>
    <div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content radius">
                <div class="modal-header">
                    <h3 class="modal-title">添加主账号</h3>
                    <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                </div>
                <form action="{:url('admin/System/doaddaccount')}" method="post">
                <div class="modal-body">

                    <!--<p>对话框内容…</p>-->
                    主账号：<input type="text" class="input-text" name="account"><br>
                    说明：<input type="text" class="input-text" name="commit"><br>
                    经纪商编号：<input type="text" placeholder="没有则不填" class="input-text" name="BrokderID"><br>
                    监控员：<input type="text" placeholder="没有则不填" class="input-text" name="MonitorID"><br>
                        <input type="hidden" name="aid" value="{$aid}">
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" type="submit" >确定</button>
                    <button class="btn" data-dismiss="modal" aria-hidden="true" type="button">关闭</button>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>

{/block}


{block name='my'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<!--<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    function modaldemo(){
        $("#modal-demo").modal("show")
    }
    $(function(){
//        $('.table-sort').dataTable({
//            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
//            "bStateSave": true,//状态保存
//            "aoColumnDefs": [
//                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
//                {"orderable":false,"aTargets":[]}// 制定列不参与排序
//            ]
//        });

    });
    /*用户-添加*/
    function addvip(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-查看*/
    function member_show(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
                    $(obj).remove();
                    layer.msg('已停用!',{icon: 5,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    /*用户-启用*/
    function member_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                    $(obj).remove();
                    layer.msg('已启用!',{icon: 6,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    /*用户-编辑*/
    function member_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*密码-修改*/
    function change_password(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    $('#p').change(function () {
        var c=$(this).val();
        $('#pc').val(c);
        $('#myform').submit();

    })
    $('#reset').click(function () {
        $('#name').val('');
        $('#number').val('');
        $('#myform').submit();
    })

</script>

{/block}